@extends('home.layout.demo')
<!--重写头部,加上收藏,分享信息-->
<center>

<link rel="stylesheet" href="{{asset('/playCSS/saved_resource')}}" type="text/css">
<link rel="stylesheet" href="{{asset('/homeCSS/zui/css/zui.min.css')}}" type="text/css">
<link rel="stylesheet" href="{{asset('/homeCSS/zui/js/zui.min.js')}}" type="text/css">


<div style="width:100%;height:500px;margin-top:70px;">
<video controls="controls" autoplay="autoplay" style="width:100%;height:500px;background:#000;">
  <source src="{{$video->upload}}" type="video/mp4" />
</video>
</div>
</center>

<!-- ============================================================================================= -->
<!-- 联网使用分享插件 -->
<div style="width:100%;height:50px;background: #fff;">
	<div style="margin-top:13px;margin-left:20px;float:left;">
		<span style="margin-right:20px;font-size:16px;color:#ccc;">{{$video->film}}</span>
		<span style="margin-right:20px;font-size:16px;color:#ccc;">{{$video->describe}}</span>
		<span style="margin-right:20px;font-size:16px;color:#ccc;">点击量({{$video->click}})</span>
		<!-- 三元运算判断是否已收藏 -->
		<span id="collection" style="margin-right:20px;font-size:16px;color:#ccc;">{{ $collection ? '取消收藏' : '收藏' }}</span>
	</div>
	<!-- ==================================================================== -->
	
	<!--<div style="margin-top:13px;float:right;margin-right:20px;" class="jiathis_style">

		<span class="jiathis_txt">分享到：</span>
		<a class="jiathis_button_icons_1"></a>
		<a class="jiathis_button_icons_2"></a>
		<a class="jiathis_button_icons_3"></a>
		<a class="jiathis_button_icons_4"></a>
		<a href="http://www.jiathis.com/share" class="jiathis jiathis_txt jtico jtico_jiathis" target="_blank"></a>
		<a class="jiathis_counter_style"></a>
	</div>
	<script type="text/javascript" src="http://v3.jiathis.com/code_mini/jia.js" charset="utf-8"></script>
	<!-- JiaThis Button END 
	<!-- ==================================================================== -->
</div>
<!-- ============================================================================================== -->
	
	


	<input type="hidden" id="vid" value="{{$video->id}}">
	

	<div style="width:100%;">
	<!-- ================================================================================== -->
	<div style="float:right;background:#fff;margin-top:5px;margin-right:20px;width:300px;">
		<div  style="margin-top:10px;margin-left:10px;">  
				
				<!--推荐视频在点击海报时查询同类别视频,分配到本模板-->
				<h2>推荐视频</h2>
				<ul style="margin-top:10px;">
				@foreach($recommend as $k=>$v)
				      <li style="margin-bottom:10px;border-bottom:1px dashed #ccc;">
				      <a href="/play/index?vid={{$v->id}}" target="_blank"> 
				      	<span style="color:pink;">{{$v->film}}</span>
				        </a>
				      </li>  
				@endforeach
				</ul>
			
		</div>
	</div>
	<!-- ================================================================================== -->
<!-- 	<div STYLE="border:1px solid red;"></div>   -->      
	 			<!-- 判断是否登录待处理 -->
 @if(session('uid'))<div class="course-subcontainer clearfix" style="margin-top:20px; margin-left:20px; width:900px;">
	  <div class="course-left">
	      <ul class="course-menu course-video-menu clearfix js-course-menu" data-ower="all" data-sort="last" style="position: absolute; left: 0px;">
	    <li class="course-menu-item">
	    	<a class="active" href="javascript:void(0)" id="plMenu">评论</a>
	    </li>
	       </ul>
	<div id="disArea" class="lists-container list-wrap" >
	    <div id="pl-content" class="list-tab-con">
 				<div class="publish clearfix" id="discus-publish">
	            	<div class="publish-wrap publish-wrap-pl">
	                <div class="pl-input-wrap clearfix">
	                    <a href="#" class="user-head l">
	                        {!! \App\Http\Controllers\ShareController::share() !!}
	                    </a>
	                    <div id="js-pl-input-fake" class="pl-input-inner l">
	                       <textarea id="js-pl-textarea" class="js-placeholder" placeholder="扯淡、吐槽、表扬、鼓励……想说啥就说啥！"></textarea>
	                       <span class="num-limit"><span id="js-pl-limit">0</span>/300</span>
	                    </div>
	                    <div class="pl-input-btm input-btm clearfix">
	                        <div class="verify-code l"></div>
	                        <input type="button" id="js-pl-submit" class="r course-btn" value="发表评论">
	                    </div>
	                </div>

	            </div>
	        </div>
	@else<div class="course-subcontainer clearfix" style="margin-top:20px; margin-left:20px; width:900px;">
	  <div class="course-left">
	      <ul class="course-menu course-video-menu clearfix js-course-menu" data-ower="all" data-sort="last" style="position: absolute; left: 0px;">
	    <li class="course-menu-item">
	    	<a class="active" href="javascript:void(0)" id="plMenu">评论<span style="margin-left:300px;color:red;font-size:15px;margin-bottom:50px;">亲,登录才能评论呦</span></a>

	    </li>
	       </ul>
	<div id="disArea" class="lists-container list-wrap">
	    <div id="pl-content" class="list-tab-con">
	
	@endif
	 			
	 			
	 		<div id="ping" style="background: #fff;margin-left:70px;">
				@foreach($vcomment as $k=>$v)
		        <div id="lun" class="pl-container"> <ul>   
			        <li class="pl-list clearfix"> 
				        <div class="pl-list-avator"> 
					        <a href="#" target="_blank">
					          <img id="vimg" width="40" height="40" src="{{$v->portrait}}" title="DanielP">
					        </a>
					    </div>
					    <div class="pl-list-main">
						         <div class="pl-list-nick"> 
						           <a class="vuser" href="#" target="_blank">{{$v->nickname}}</a> 
					        	 </div>
							<div class="vmessage" class="pl-list-content">{{$v->message}}
							</div>
						           <div class="pl-list-btm clearfix"> 
							           <span id="vtime" class="pl-list-time l">
							           	<!-- 时间判断 -->
							           	<!-- ================================================== -->
							           	<span class="pl-list-time l">
							           	@if(time()-$v->time>='0'&& time()-$v->time<'60') 时间:{{time()-$v->time}}秒前
							           	@elseif(time()-$v->time>='60' && time()-$v->time<'3600') 时间:{{ltrim(date('i',(time()-$v->time)),'0')}}分钟前
							           	@elseif(time()-$v->time>='3600' && time()-$v->time<'43200') 时间:{{date('h',time()-$v->time)}}小时前
							           	@else 时间:{{date('m月d日',$v->time)}}
							           	@endif	
							           	</span>
							           	<!-- ==================================================== -->
							           </span> 
						           </div> 
				           	</div>
			           </li> 
		        </div>
		         @endforeach
		    </div>  
		   
		    </div>
	    </div>
	   </div>
	   </div>
	  </div>
	</div>

	<script type="text/javascript" src="{{asset('/homeCSS/js/jquery-1.8.3.min.js')}}"></script>
	<script>

	  //用户评论ajax

	  //用户名绑定丧失焦点事件
	  $('#js-pl-submit').click(function(){
	  

	   		 if($('#js-pl-textarea').val() != ''){
	   		   //发送ajax把评论插入数据库
	   		   var inp = $('#js-pl-textarea');

	   		   $.ajax({
	   		     url:'/play/comment',
	   		     data:{comment:inp.val(),vid:$('#vid').val()},
	   		     type:'get',
	   		     success:function(data){
	   		     	
	   		       	//在控制器中返回视图
	   		         $('#ping').prepend(data);
	   		     },
	   		     async:false
	   		   })
	   		 }else{
	   		 
	    		alert('评论不能为空');  
	   		 }
	  })

		$("#collection").mouseover(function(){
		  $("#collection").css("cursor","pointer");
		});
	  //收藏与取消收藏(鼠标上浮变小手待做),不登录不能收藏
	  $('#collection').click(function(){
	  	var collection = $('#collection').html();
	  	if(collection =='收藏'){

	  		//发送ajax,改变状态
	  		// ======================================================
	  		$.ajax({
	  		  url:'/play/collection',
	  		  data:{vid:$('#vid').val(),status:0},
	  		  type:'get',
	  		  success:function(data){
	  		    if(data == 1){
	  		    	$('#collection').html('取消收藏');
	  		    }else{

	  		    }
	  		  },
	  		  async:false
	  		})

	  		// ======================================================
	  		
	  	}else{

	  		//发送ajax,改变状态
	  		// ======================================================
	  		$.ajax({
	  		  url:'/play/collection',
	  		  data:{vid:$('#vid').val(),status:1},
	  		  type:'get',
	  		  success:function(data){
	  		    if(data == 1){
	  		    	$('#collection').html('收藏');
	  		    }else{
	  		    	
	  		    }
	  		  },
	  		  async:false
	  		})

	  		// ======================================================
	  	}
	  })

	</script>
</div>

